package com.xuecheng.content.api;

import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@Api(value = "师资管理",tags = "师资管理")
public class CourseTeacherController {
    @Autowired
    CourseTeacherService courseTeacherService;
    @ApiModelProperty("根据课程id查询师资信息")
    @GetMapping("/courseTeacher/list/{courseid}")
    public List<CourseTeacher> list(@PathVariable Long courseid){
        return courseTeacherService.list(courseid);
    }
    @ApiModelProperty("添加/修改师资信息")
    @PostMapping("/courseTeacher")
    public CourseTeacher addCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        return courseTeacherService.save(courseTeacher);
    }
    @ApiModelProperty("删除课程信息")
    @DeleteMapping("/courseTeacher/course/{courseid}/{id}")
    public void deleteCourseTeacher(@PathVariable Long courseid,@PathVariable Long id){
        courseTeacherService.deleteOne(courseid,id);
    }
}
